package com.sf.dlb.utils;

import com.sf.dlb.constant.ResponseConstant;
import org.apache.commons.lang.StringUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * VO实体state-》Value的转换工具类
 * Created by tanjing on 2019/2/13.
 */
public class StateToValueUtils {
    /**
     * 用户dlb流水
     * @param state
     * @return
     */
    public static String switchUserDlbRecordValue(String state){
        switch (state){
            case ResponseConstant.source_type_reading:
                return ResponseConstant.source_type_reading_value;
            case ResponseConstant.source_type_the_invitation:
                return ResponseConstant.source_type_the_invitation_value;
            case ResponseConstant.source_type_register:
                return ResponseConstant.source_type_register_value;
            case ResponseConstant.source_type_extract:
                return ResponseConstant.source_type_extract_value;
            case ResponseConstant.source_type_topup:
                return ResponseConstant.source_type_topup_value;
            case ResponseConstant.source_type_video:
                return ResponseConstant.source_type_video_value;
            case ResponseConstant.source_type_recycling:
                return ResponseConstant.source_type_recycling_value;
            case ResponseConstant.source_type_buy_grade:
                return ResponseConstant.source_type_buy_grade_value;
            case ResponseConstant.source_type_buy_grade_divide:
                return ResponseConstant.source_type_buy_grade_divide_value;
            case ResponseConstant.source_type_read_divide:
                return ResponseConstant.source_type_read_divide_value;
            case ResponseConstant.source_type_money_pool_divide:
                return ResponseConstant.source_type_money_pool_divide_value;
            case ResponseConstant.source_type_other:
                return ResponseConstant.source_type_other_value;
            default:
                return  "";
        }
    }
    /**
     * 锁定类型状态转换
     * @param lockType
     * @return
     */
    public static String switchLockTypeValue(String lockType){
        if(lockType.equals("0")){
            return "锁定";
        }else if(lockType.equals("1")){
            return "解锁";
        }
        return "";
    }
    /**
     * 解锁状态转换
     * @param lockstate
     * @return
     */
    public static String switchLockStateValue(String lockstate){
        if(lockstate.equals("3")){
            return "解锁中";
        }
        else if(lockstate.equals("2")){
            return "未完成";
        }
        else if(lockstate.equals("1")){
            return "取消";
        }
        else if(lockstate.equals("0")){
            return "完成";
        }
        return "";
    }
    /**
     * 提现状态转换
     * @param extractstate
     * @return
     */
    public static String switchExtractStateValue(String extractstate){
        if(extractstate.equals("2")){
            return "未完成";
        }
        else if(extractstate.equals("1")){
            return "提现中";
        }
        else if(extractstate.equals("0")){
            return "已完成";
        }
        return "";
    }
    /**
     * 实名状态转换
     * @param state
     * @return
     */
    public static String switchRealStateValue(String state){
        if(StringUtils.isBlank(state)){
            return "未实名";
        }
//        实名状态(1未实名、2审核中、3已实名、4驳回)
        switch (state){
            case "1":
                return  "未实名";
            case "2":
                return  "审核中";
            case "3":
                return  "已实名";
            case "4":
                return  "驳回";
            default:
                return  "未实名";
        }
    }
    /**
     * 充值状态转换
     * @param state
     * @return
     */
    public static String switchTopupStateValue(String state){
        if(StringUtils.isBlank(state)){
            return "";
        }
//        充值状态(0：完成，1：未完成)
        switch (state){
            case "0":
                return  "完成";
            case "1":
                return  "未完成";
            default:
                return  "";
        }
    }
    /**
     * 用户预警-处理状态
     * @param state
     * @return
     */
    public static String switchDealtStateValue(String state){
        if(StringUtils.isBlank(state)){
            return "";
        }
//      处理状态(0已处理,1未处理,2已过期)'
        switch (state){
            case "0":
                return  "已处理";
            case "1":
                return  "未处理";
            case "2":
                return  "已过期";
            default:
                return  "";
        }
    }
    /**
     * 证件转换
     * @param idNumberType
     * @return
     */
    public static String switchIdNumberTypeValue(String idNumberType){
        if(StringUtils.isBlank(idNumberType)){
            return "";
        }
//      身份类型(1:身份证,2:驾驶证,9:其他)
        switch (idNumberType){
            case "1":
                return  "身份证";
            case "2":
                return  "驾驶证";
            case "9":
                return  "其他";
            default:
                return  "";
        }
    }
    /**
     * 认证照片添加前缀
     * @param image
     * @return
     */
    public static List realImageAddProfix(String image, String profix){
        ArrayList arrayList=new ArrayList();
        if(StringUtils.isBlank(image)){
            return arrayList;
        }
        String[] images=image.split(",");
        for (String str:images) {
            arrayList.add(profix+str);
        }
        return arrayList;
    }
    /**
     * APP版本信息-系统类型
     * @param systemType
     * @return
     */
    public static String switchAppVersionValue(String systemType){
        if(StringUtils.isBlank(systemType)){
            return "";
        }
//      系统类型(1:Android，2:IOS，3:WEB)
        switch (systemType){
            case "1":
                return  "Android";
            case "2":
                return  "IOS";
            case "3":
                return  "WEB";
            default:
                return  "";
        }
    }
    /**
     * 用户消息-类型
     * @param systemType
     * @return
     */
    public static String switchUserMessageValue(String systemType){
        if(StringUtils.isBlank(systemType)){
            return "";
        }
//      消息类型(1通知，2公告)
        switch (systemType){
            case "1":
                return  "通知";
            case "2":
                return  "公告";
            default:
                return  "";
        }
    }
    /**
     * 是否可登录-状态
     * @param loginFlag
     * @return
     */
    public static String switchLoginFlagValue(String loginFlag){
        if(StringUtils.isBlank(loginFlag)){
            return "";
        }
//     是否可登录(0=是 1=否)
        switch (loginFlag){
            case "0":
                return  "可用";
            case "1":
                return  "不可用";
            default:
                return  "";
        }
    }

    /**
     * 等级value
     * @param grade
     * @return
     */
    public static String switchGradeValue(String grade){
        if(StringUtils.isBlank(grade)){
            return "";
        }
        switch (grade){
            case "0":
                return  "普通";
            case "1":
                return  "青铜";
            case "2":
                return  "白银";
            case "3":
                return  "黄金";
            default:
                return  "";
        }
    }
    /**
     * 请求头userAgent
     * @param userAgent
     * @return
     */
    public static String switchRequestUserAgent(String userAgent){
        if(userAgent.contains("Android")){
            return "1";
        }else if(userAgent.equals("iOS")){
            return "2";
        }else{
            return "-1";
        }
    }
    /**
     * 举报的类型
     * @param reportType
     * @return
     */
    public static String switchReportType(String reportType){
        if(StringUtils.isBlank(reportType)){
            return "";
        }
        switch (reportType){
            case "1":
                return  "新闻 ";
            case "2":
                return  "视频";
            case "3":
                return  "帖子";
            default:
                return  "";
        }
    }
    /**
     * 举报的处理
     * @param processWay
     * @return
     */
    public static String switchProcessWay(String processWay){
        if(StringUtils.isBlank(processWay)){
            return "";
        }
        switch (processWay){
            case "0":
                return  "忽略 ";
            case "1":
                return  "删除";
            default:
                return  "";
        }
    }

}
